package com.company.hrmadmin.common.util;

import com.company.hrmadmin.modules.domain.User;
import org.springframework.stereotype.Component;

/**
 * 持有登录用户对象
 *
 * @author Song, Wei
 * Date: 2022/3/18 18:14
 */
@Component
public class HostHolder {

    private static final ThreadLocal<User> users = new ThreadLocal<>();

    public void setUser(User user) {
        users.set(user);
    }

    public User getUser() {
        return users.get();
    }

    public void removeUser() {
        users.remove();
    }

}
